import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/login/Login'
import Home from '@/views/home/Home'
import Board from '@/views/board/Border'
import UserManager from '@/views/system/userManager/UserManager'
import AddBlog from '@/views/blog/AddBlog'
Vue.use(VueRouter)


const routes = [
  /**
   * 访问的地址为:/ 就转发到/login地址
   */
  { path: '/', redirect: '/login' },
  /**
   * 访问的地址为:/login 就使用Login组件进行渲染
   */
  { path: "/login", component: Login },
  /**
   * 访问的地址为:/home 就使用Home组件进行渲染
   */
  {
    path: "/home",
    component: Home,
    redirect: "/board",
    meta: { title: "首页" },
    children: [
      { path: "/board", meta: { title: "信息看板" }, component: Board },
      { path: "/userManager", meta: { title: "用户管理" }, component: UserManager },
      { path: "/blogAdd", meta: { title: "新增博客" }, component: AddBlog },
    ]
  },
]

const router = new VueRouter({
  routes
})

export default router
